import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/pages/home/Home.vue'
import Data from '@/pages/data/Data.vue'
import Detail from '@/pages/data/Detail.vue'
import Helper from '@/pages/helper/Helper.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/data/:experimentType?/:sampleType?',
      name: 'data',
      meta: {
        keepAlive: true
      },
      component: Data
    },
    {
      path: '/detail/:title/:sampleType/:experimentType',
      name: 'detail',
      component: Detail
    },
    {
      path: '/helper',
      name: 'helper',
      component: Helper
    },
  ],
  scrollBehavior (to, from, savedPosition) {
    // 滚动到顶部
    return { top: 0 }
  }
})

export default router
